Repository Public
1/**2 * =============================================================================3 * SP BOUCHER | SOFTWARE & RESEARCH4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : ORIX App Universe8 * File : src/app/[locale]/models/page.tsx9 * Module : app10 * Repository : https://git.spboucher.ai/orix-spboucher-ai11 * Project Website : https://www.orixlab.dev12 * Created : 2026-11-2213 * Last Modified : 2026-11-2214 *15 * Author : Simon-Pierre Boucher16 * Position : Professor of Finance17 * Institution : Université du Québec en Outaouais (UQO)18 * Organization : SP Boucher19 * Website : https://spboucher.ai20 * Git : https://git.spboucher.ai21 *22 * Preferred Contact: support@spboucher.ai23 * Development : dev@spboucher.ai24 * Support : support@spboucher.ai25 * Security/Admin : admin@spboucher.ai26 *27 * Copyright (c) 202628 * Simon-Pierre Boucher29 * All rights reserved where applicable. This file is governed by the30 * applicable project license, copyright notices and relevant law.31 * Existing third-party rights and notices remain unaffected.32 *33 * License : None specified (no license file in this repository)34 *35 * Do not embed credentials, private keys, access tokens,36 * certificates or confidential personal information.37 *38 * =============================================================================39 * END OF SP BOUCHER SOURCE HEADER40 * =============================================================================41 */4243import type { Metadata } from "next";44import { modelLibrary, gigabytes, type ModelGroup, type OrixModel } from "@/lib/models";45import { dict, fmtDate, isLocale, type Locale } from "@/lib/i18n";46import { alternates } from "@/lib/seo";4748export const revalidate = 300;4950export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }): Promise<Metadata> {51 const { locale } = await params; const t = dict(locale as Locale);52 return { title: t.models.title, description: t.models.lead, alternates: alternates("/models", locale as Locale) };53}5455const num = (v: number, locale: Locale, digits = 1) => v.toLocaleString(locale === "fr" ? "fr-CA" : "en-CA", { minimumFractionDigits: digits, maximumFractionDigits: digits });56const size = (bytes: number, locale: Locale) => (bytes >= 1_073_741_824 ? `${num(gigabytes(bytes), locale)} ${locale === "fr" ? "Go" : "GB"}` : `${num(bytes / 1_048_576, locale, 0)} ${locale === "fr" ? "Mo" : "MB"}`);57const params = (n: number | null, locale: Locale) => (n == null ? "–" : n >= 1e9 ? `${num(n / 1e9, locale)} ${locale === "fr" ? "Md" : "B"}` : `${num(n / 1e6, locale, 0)} M`);5859function Row({ m, locale }: { m: OrixModel; locale: Locale }) {60 const t = dict(locale).models;61 return (62 <li className="card p-6 sm:p-7" data-testid="model" data-model={m.id}>63 <div className="flex flex-wrap items-start justify-between gap-x-6 gap-y-3">64 <div className="min-w-0">65 <h3 className="h3">{m.name}</h3>66 <p className="mt-1 text-[0.9rem] text-ink3">{[m.publisher, m.quantization.startsWith("none") ? t.unquantized : m.quantization, m.license].filter(Boolean).join(" · ")}</p>67 </div>68 <span className="inline-flex flex-wrap gap-1.5">69 {m.onMac && <span className="tag">Mac</span>}70 {m.onPhone && <span className="tag">iPhone · iPad</span>}71 </span>72 </div>73 <dl className="mt-5 grid grid-cols-2 gap-x-6 gap-y-4 text-[0.92rem] sm:grid-cols-4">74 <div><dt className="text-ink3">{t.cols.parameters}</dt><dd className="mono mt-0.5 font-semibold">{params(m.parameters, locale)}</dd></div>75 <div><dt className="text-ink3">{t.cols.download}</dt><dd className="mono mt-0.5 font-semibold">{size(m.bytes, locale)}</dd></div>76 <div><dt className="text-ink3">{t.cols.memory}</dt><dd className="mono mt-0.5 font-semibold">{m.macMemoryGB ? t.memory(m.macMemoryGB) : "–"}</dd></div>77 <div><dt className="text-ink3">{t.cols.speed}</dt><dd className="mono mt-0.5 font-semibold">{m.speed ? `${num(m.speed, locale)} tok/s` : "–"}</dd></div>78 </dl>79 <p className="mt-5 flex flex-wrap gap-1.5">80 {m.capabilities.map((c) => <span key={c} className="tag">{t.capabilities[c as keyof typeof t.capabilities] ?? c}</span>)}81 {m.context ? <span className="tag">{t.context(m.context)}</span> : null}82 </p>83 <p className="mt-4 text-[0.85rem] text-ink3">84 {m.hosted ? t.hostedHere : t.hostedElsewhere}85 {m.repo ? <> · <span className="mono">{m.repo}</span></> : null}86 </p>87 </li>88 );89}9091export default async function Models({ params: p }: { params: Promise<{ locale: string }> }) {92 const { locale: raw } = await p; const locale: Locale = isLocale(raw) ? raw : "en";93 const t = dict(locale).models, lib = await modelLibrary();94 const groups: ModelGroup[] = ["mac", "both", "phone"];95 const machine = lib.models.find((m) => m.machine)?.machine ?? null;96 return (97 <>98 <header className="relative isolate overflow-hidden pb-6 pt-32 sm:pt-44">99 <div className="aurora -z-10" aria-hidden /><div className="stars -z-10" aria-hidden /><div className="gridlines -z-10" aria-hidden />100 <div aria-hidden className="pointer-events-none absolute inset-x-0 bottom-0 -z-10 h-40 bg-gradient-to-b from-transparent to-bg" />101 <div className="wrap wrap-wide">102 <p className="eyebrow">{t.eyebrow}</p>103 <h1 className="display mt-6 max-w-5xl !text-[clamp(2.6rem,6.6vw,5.4rem)]">{t.title}</h1>104 <p className="lead mt-7">{t.lead}</p>105 {lib.models.length > 0 && (106 <p className="mono mt-8 text-[0.85rem] text-ink3" data-testid="models-summary">107 {t.summary(lib.models.length, lib.models.filter((m) => m.hosted).length, num(gigabytes(lib.hostedBytes), locale, 0))}108 {lib.updated ? ` · ${t.updated(fmtDate(lib.updated, locale))}` : ""}109 </p>110 )}111 </div>112 </header>113 <section className="wrap wrap-wide section !pt-12" aria-label={t.title}>114 {lib.models.length === 0 ? <p className="card p-10 text-center text-ink2" data-testid="models-empty">{t.empty}</p> : groups.map((g) => {115 const list = lib.models.filter((m) => m.group === g);116 if (!list.length) return null;117 return (118 <div key={g} className="mb-20 last:mb-0" data-testid={`models-${g}`}>119 <div className="rule pt-6">120 <h2 className="h2">{t.groups[g].title} <span className="mono align-middle text-[0.9rem] font-semibold text-ink3">{list.length}</span></h2>121 <p className="mt-3 max-w-3xl text-[0.98rem] text-ink2">{t.groups[g].body}</p>122 </div>123 <ul className="mt-8 grid gap-5 lg:grid-cols-2">{list.map((m) => <Row key={m.id} m={m} locale={locale} />)}</ul>124 </div>125 );126 })}127 <ol className="mt-20 grid gap-x-10 gap-y-8 md:grid-cols-3">128 {t.notes.map(([title, body], i) => (129 <li key={title} className="rule pt-6">130 <span className="mono beam-text text-[0.8rem] font-semibold tracking-[0.16em]">0{i + 1}</span>131 <h2 className="h3 mt-3">{title}</h2>132 <p className="mt-2 text-[0.96rem] text-ink2">{body}</p>133 </li>134 ))}135 </ol>136 {machine && <p className="mt-14 text-[0.9rem] text-ink3">{t.measured(machine)}</p>}137 </section>138 </>139 );140}141